﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeBehind="Add.aspx.cs" Inherits="lcs.Web.demandmaterialinfo.Add" Title="增加页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../../js/jquery-1.6.1.min.js"></script>
    <link href="../../js/jquery.autocomplete.css" rel="stylesheet" />
    <script src="../../js/jquery.autocomplete.js"></script>
    <script src="../../My97DatePicker/WdatePicker.js"></script>
     <script type="text/javascript">
         var type=<%# type%>;
         function GetJobTitle(obj) {
             $(obj).autocomplete("../../HandlerMbm.ashx", {
                 max: 12,    //列表里的条目数
                 minChars: 0,    //自动完成激活之前填入的最小字符
                 width: 300,     //提示的宽度，溢出隐藏
                 scrollHeight: 300,   //提示的高度，溢出显示滚动条
                 matchContains: true,    //包含匹配，就是data参数里的数据，是否只要包含文本框里的数据就显示
                 autoFill: false,    //自动填充
                 extraParams: { key: function () { return encodeURIComponent($(obj).val()); }, key1: type },
                 parse: function (data) {
                     if(data!="")
                     return $.map(eval(data), function (row) {
                         return {
                             data: row,
                             value: row.mms,
                             result: row.mms
                         }
                     }); //对ajax页面传过来的数据进行json转码
                 },
                 formatItem: function (row, i, max) {
                     return row.mms;
                 },
                 formatMatch: function (row, i, max) {
                     return row.mms ;
                 },
                 formatResult: function (row) {
                     return row.mms;
                 }
             }).result(function (event, row, formatted) {
                 if(type!='0')
                 {
                     $("#<%# txtprice.ClientID%>").val(row.mprice);  
                     $("#<%# hfprice.ClientID%>").val(row.mprice); 
                    
                 }
                 $("#<%# hfmbm.ClientID%>").val(row.mbm);
                 $("#<%# lblmbm.ClientID%>").text(row.mbm); 
                 return row.mms;
             });
         }
         $(function () {
             var ac = $("#<%# txtmms.ClientID%>");
             GetJobTitle(ac);
             var es=$("#<%# txtnum.ClientID%>");
             es.blur(function (){
                 var num=$("#<%# txtnum.ClientID%>").val();
                 var pric=$("#<%# txtprice.ClientID%>").val();
                 if(num!=""&&pric!="")
                 $("#<%# txtestimate.ClientID%>").val(parseFloat(num)*parseFloat(pric)/10000)
             });
             var et=$("#<%# txtprice.ClientID%>");
             et.blur(function (){
                 var num=$("#<%# txtnum.ClientID%>").val();
                 var pric=$("#<%# txtprice.ClientID%>").val();
                 if(num!=""&&pric!="")
                 $("#<%# txtestimate.ClientID%>").val(parseFloat(num)*parseFloat(pric)/10000)
             });

         });
         </script>   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">    
    <table style="width: 100%;" cellpadding="2" cellspacing="1" class="border">
        <tr>
            <td class="tdbg">
                
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
	<tr>
	<td height="25" width="30%" align="right">
		物料描述
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtmms" runat="server" Width="200px"></asp:TextBox>
	</td></tr>
	<tr>
	<td height="25" width="30%" align="right">
        
		物料编码
	：</td>
	<td height="25" width="*" align="left">
        <asp:HiddenField ID="hfmbm" runat="server" />
		<asp:Label ID="lblmbm" runat="server" Text=""></asp:Label></td></tr>
	<tr>
	<td height="25" width="30%" align="right">
		电压等级千伏
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtvtype" runat="server" Width="200px"></asp:TextBox>
	</td></tr>
    <tr>
	<td height="25" width="30%" align="right">
		价格
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtprice" runat="server" Width="60px"></asp:TextBox><asp:HiddenField ID="hfprice" runat="server" />

	</td></tr>
	<tr>
	<td height="25" width="30%" align="right">
		需用数量
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtnum" runat="server" Width="60px"></asp:TextBox>
	</td></tr>
    <tr>
	<td height="25" width="30%" align="right">
		行价格（万元）
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtestimate" runat="server" Width="60px" ></asp:TextBox>
	</td></tr>
	<tr>
	<td height="25" width="30%" align="right">
		交货时间
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox ID="txtdeliverytime" runat="server" Width="150px"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})"></asp:TextBox>
	</td></tr>
	<tr>
	<td height="25" width="30%" align="right">
		交货地点
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtdeliveryadd" runat="server" Width="200px"></asp:TextBox>
	</td></tr>
	
	
	<%--<tr>
	<td height="25" width="30%" align="right">
		计划编号
	：</td>
	<td height="25" width="*" align="left">
		<asp:TextBox id="txtdpid" runat="server" Width="200px"></asp:TextBox>
	</td></tr>--%>
</table>

            </td>
        </tr>
        <tr>
            <td class="tdbg" align="center" valign="bottom">
                <asp:Button ID="btnSave" runat="server" Text="保存"
                    OnClick="btnSave_Click" class="inputbutton" ></asp:Button>
                <asp:Button ID="btnCancle" runat="server" Text="取消"
                    OnClick="btnCancle_Click" class="inputbutton" ></asp:Button>
            </td>
        </tr>
    </table>
    <br />
</asp:Content>
<%--<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceCheckright" runat="server">
</asp:Content>--%>
